# -*- coding=utf-8 -*-
import jeepay
from jeepay.app_config import AppConfig

# 配置信息
api_key = "YLfBTJQB1rXVNgGk9VuGTwinpYnQWPoAK4EvgUd1DBcMKzzQ3UxpD6tcND7qlUVBjmwJ933U12u0bhPgr3QSxfK4U6zX9RomJlhT9kDooNDaW6hc2jpDnPWTZJGYCyHb"
AppConfig.set_mch_no("M1679219294")
AppConfig.set_app_id("6416da5ee4b00bed884be286")
AppConfig.set_api_key(api_key)

"""
支付 API 文档：https://docs.jeequan.com/docs/jeepay/payment_api
"""

print("发起订单分账")
try:
    exec = jeepay.Division.exec(
        payOrderId="P1721732006052859906",  # 支付订单号，与mchOrderNo二者传一即可
        # mchOrderNo="",  # 商户订单号，与payOrderId二者传一即可
        useSysAutoDivisionReceivers=1  # 是否使用系统配置的自动分账组，0-否 1-是
    )
    print(exec)
except Exception as e:
    print(e)
